package com.code.springboot3.enums;

import lombok.Getter;

@Getter
public enum MenuEnum {
    USER("普通用户", "user"),
    ADMIN("管理员", "admin"),
    ARTICLE_MANAGER("文章管理员", "article_manager"),
    COMMENT_MANAGER("评论管理员", "comment_manager");
    
    private final String name;
    private final String code;
    
    MenuEnum(String name, String code) {
        this.name = name;
        this.code = code;
    }
    
    public static MenuEnum getByCode(String code) {
        for (MenuEnum menu : values()) {
            if (menu.getCode().equals(code)) {
                return menu;
            }
        }
        return null;
    }
} 